
<template >
  <div class="layout" :class="{'layout-hide-text': spanLeft < 5}" v-loading="spinShow">
    <Row style="height: 100%;" type="flex" >
      <Col v-show="toggle" :span="spanLeft" class="layout-menu-left" >
      <leftmenu></leftmenu>
      </Col>
      <Col :span="spanRight" :class="tright" >
      <rightspan></rightspan>
      </Col>
    </Row>
    <Modal
      :value="modal1"
      title="普通的Modal对话框标题"
      @on-ok="comfirmModifyPS">
      <p>对话框内容</p>
      <p>对话框内容</p>
      <p>对话框内容</p>
    </Modal>
  </div>
  <!-- 修改密码 模态框 -->

  <!-- 修改密码 模态框 -->
</template>

<script>
  import {mapActions, mapState} from 'vuex'
  import leftmenu from '../components/layout/leftMenu.vue'
  import rightspan from '../components/layout/rightspan.vue'
  export default {
    data () {
      return {
        modeType: "vertical",
        modal1: false,
        spinShow: false,//数据刷新遮罩层
        spanLeft: 5,
        spanRight: 19,
        logoIsDisplay: false,
//        toggle: true,
        rightStyle: "layout-right",
        photo: "../assets/default.jpg"
      }
    },
    components: {
      leftmenu,
      rightspan
    },
    computed: {
      ...mapState(['toggle',  'msg', 'isLogin', 'userprof']),
      tright(){

        if (!this.toggle) {
          return  "layout-right-toggle"
        } else {
          return "layout-right"
        }
      },
    },
    watch: {
      // 如果 userprof 发生改变，这个函数就会运行
      userprof: function (newQuestion) {
        this.welcom()
      }
    },
    methods: {
      toggleClick () {
        console.log(this.toggle)
        if (!this.toggle) {
          this.rightStyle = "layout-right-toggle"
          this.spanLeft = 1
          this.spanRight = 23
        } else {
          this.rightStyle = "layout-right"
          this.spanLeft = 5
          this.spanRight = 19
        }
//        this.toggle=this.getToggle
//        this.toggle = !this.toggle
      },
      modifyPassWord() {
        this.modal1 = true;
      },
      logOut() {
        this.logout()
        this.$router.replace('/login');
      },
      comfirmModifyPS() {
        this.$Message.info('点击了确定');
      },
      menuSelect(name) {
        this.$router.push({path: name});
      },
      welcom(){
//        this.spinShow=true

        if (this.isLogin){
          this.$Notice.success({
            title: '欢迎'+ this.userprof.Title +'登陆系统',
            desc: '祝您有美好的一天！'
          });
        }
      },
    },
    mounted(){
//      this.welcom()
//      this.getUserInfo()
    }
  }
</script>
